package com.kin207.netty.util;

public class StringParseUtils {
	private String source;

	public StringParseUtils() {
	}

	public StringParseUtils set(String source) {
		this.source = source;
		return this;
	}

	public boolean isNull() {
		return this.source == null;
	}

	public boolean isEmpty() {
		return isNull() || ("".equals(this.source.trim()));
	}

	public String get() {
		return source;
	}

	public int getInt() {
		if (source == null || "".equals(source)) {
			return 0;
		}
		return Integer.parseInt(source);
	}

	public int getInteger() {
		if (source == null || "".equals(source)) {
			return 0;
		}
		return Integer.valueOf(source);
	}

	public String[] split(String regex) {
		return this.source.split(regex);
	}
}
